/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trial.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
 * @author feifei
 */
@Entity
@XmlRootElement
@XmlType(name = "OrderSet", propOrder = {
    "id",
    "customer",
    "shop",
    "orders"
})
@Table(name = "TRIAL_ORDERSET",schema="trial")
public class OrderSet implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    @ManyToOne
    private Customer customer;
    @ManyToOne
    private Shop shop;
    @OneToMany(mappedBy="orderSet")
    private List<SingleOrder> orders;


    public OrderSet() {
    }

    public OrderSet(Customer customer,Shop shop) {
        this.shop = shop;
        this.customer = customer;
    }
    
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Shop getShop() {
        return shop;
    }

    public void setShop(Shop shop) {
        this.shop = shop;
    }
    
    
   
    public List<SingleOrder> getOrders() {
        return orders;
    }

    public void setOrders(List<SingleOrder> orders) {
        this.orders = orders;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public Customer getCustomer() {
        return customer;
    }

    
    
   

 

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }
    
    
    
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrderSet)) {
            return false;
        }
        OrderSet other = (OrderSet) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "trial.entity.OrderSet[ id=" + id + " ]";
    }
    
}
